Package ch.derlin.grmetafetcher

Types

Link copied to clipboard
interface CompilableToString

Classes implementing this interface should provide a method for printing themselves into "compilable strings", that is strings that can be copy-pasted into a kotlin file and compile.

Link copied to clipboard
data class GoodReadsLookup(    val title: String,     val author: String? = null,     val includeAuthorInSearch: Boolean = author != null) : CompilableToString

Find books on GoodReads.

Link copied to clipboard
data class GoodReadsMetadata(    val title: String,     val authors: List<String>,     val url: String,     val id: String,     val isbn: String?,     val pages: Int?,     val pubDate: LocalDate?) : CompilableToString, Serializable

Get book metadata from a GoodReads details page, a GoodReads ID or title/author.

Link copied to clipboard
class GoodReadsPaginatedSearchResults(searchUrl: String)

Wrapper of GoodReadsSearchResult that can be used to fetch more than the results of the first page.

Link copied to clipboard
data class GoodReadsSearchResult(    val title: String,     val authors: List<String>,     val url: String) : Serializable, CompilableToString

Results of a search in GoodReads (see GoodReadsLookup).

Link copied to clipboard
object GoodReadsUrl

Helper object to construct GoodReads URLs.

Link copied to clipboard
class GrMissingElementException(message: String) : RuntimeException

Exception thrown when an HTML element is missing on the page, making the parsing impossible (e.g. no authors class).

Link copied to clipboard
class GrNotFoundException(message: String) : Exception

Exception thrown when no match is found on GoodReads search results.

Link copied to clipboard
class GrParseException(message: String) : RuntimeException

Exception thrown in case the HTML elements are present, but something goes wrong while parsing the content (e.g. wrong authors format).

Link copied to clipboard
class Retry(val retryConfiguration: RetryConfiguration, val retryWhen: (Throwable) -> Boolean = ::retryIfServerFault)

Instantiate a "retrier", than can be used to wrap any call to GoodReads. GoodReads tends to return 5XX errors codes sporadically, so this is useful when automating tasks.

Link copied to clipboard
data class RetryConfiguration(    val maxRetries: Int,     val interval: Long,     val multiplier: Float = 1.0f)

Specify how retries should be performed. See Retry.